import 'package:flutter/material.dart';

import '../../foundation/decoration/shadow_decoration.dart';
import 'public_tab_bar.dart';

/// FileName preferred_size_tab_bar
///
/// @Author lax
/// @Date 2023/4/4
///
/// @Description

class PreferredSizeTabBar extends PreferredSize {
  PreferredSizeTabBar({
    super.key,
    Size preferredSize = const Size.fromHeight(40),
    Color color = Colors.white,
    TabController? controller,
    bool isScrollable = false, // 是否可以左右滚动
    List<Widget>? tabs,
  }) : super(
          preferredSize: preferredSize,
          child: Container(
            decoration: ShadowDecoration(color: color),
            child: isScrollable
                ? Row(
                    children: [
                      Expanded(
                        child: Container(
                          alignment: Alignment.center,
                          child: PublicTabBar(
                            controller: controller,
                            isScrollable: isScrollable,
                            tabs: tabs,
                          ),
                        ),
                      ),
                    ],
                  )
                : PublicTabBar(
                    controller: controller,
                    isScrollable: isScrollable,
                    tabs: tabs,
                  ),
          ),
        );
}
